how to implement pytorch model